﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dukou.Domain;

namespace Dukou.Dao
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IEntityDao<T, TId> where T : IEntity<TId>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T FindById(TId id);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<T> SelectAll();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="start"></param>
        /// <param name="number"></param>
        /// <returns></returns>
        IList<T> SelectAll(int start, int number);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        TId Save(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void SaveOrUpdate(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Update(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Delete(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        void Delete(Type type, TId id);
    }
}
